home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / keyword.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-11-11  |  2KB  |  93 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Keywords (from "graminit.c")
  5.  
  6. This file is automatically generated; please don\'t muck it up!
  7.  
  8. To update the symbols in this file, \'cd\' to the top directory of
  9. the python source tree after building the interpreter and run:
  10.  
  11.     python Lib/keyword.py
  12. '''
  13. __all__ = [
  14.     'iskeyword',
  15.     'kwlist']
  16. kwlist = [
  17.     'and',
  18.     'as',
  19.     'assert',
  20.     'break',
  21.     'class',
  22.     'continue',
  23.     'def',
  24.     'del',
  25.     'elif',
  26.     'else',
  27.     'except',
  28.     'exec',
  29.     'finally',
  30.     'for',
  31.     'from',
  32.     'global',
  33.     'if',
  34.     'import',
  35.     'in',
  36.     'is',
  37.     'lambda',
  38.     'not',
  39.     'or',
  40.     'pass',
  41.     'print',
  42.     'raise',
  43.     'return',
  44.     'try',
  45.     'while',
  46.     'with',
  47.     'yield']
  48. iskeyword = frozenset(kwlist).__contains__
  49.  
  50. def main():
  51.     import sys as sys
  52.     import re as re
  53.     args = sys.argv[1:]
  54.     if not args or args[0]:
  55.         pass
  56.     iptfile = 'Python/graminit.c'
  57.     if len(args) > 1:
  58.         optfile = args[1]
  59.     else:
  60.         optfile = 'Lib/keyword.py'
  61.     fp = open(iptfile)
  62.     strprog = re.compile('"([^"]+)"')
  63.     lines = []
  64.     for line in fp:
  65.         if '{1, "' in line:
  66.             match = strprog.search(line)
  67.             if match:
  68.                 lines.append("        '" + match.group(1) + "',\n")
  69.             
  70.         match
  71.     
  72.     fp.close()
  73.     lines.sort()
  74.     fp = open(optfile)
  75.     format = fp.readlines()
  76.     fp.close()
  77.     
  78.     try:
  79.         start = format.index('#--start keywords--\n') + 1
  80.         end = format.index('#--end keywords--\n')
  81.         format[start:end] = lines
  82.     except ValueError:
  83.         sys.stderr.write('target does not contain format markers\n')
  84.         sys.exit(1)
  85.  
  86.     fp = open(optfile, 'w')
  87.     fp.write(''.join(format))
  88.     fp.close()
  89.  
  90. if __name__ == '__main__':
  91.     main()
  92.  
  93.